import React, { Component } from 'react'
export default class App extends Component {
  
  getData = () => {
    console.log(this.refs.username.value)
    console.log('test', document.getElementById('test').value)
  }

  render() {
    return (
      <div>
        <input ref="username"  id="test" type="text" />
        <button onClick = { this.getData }>获取数据</button>
      </div>
    )
  }
}
